<script src="../../../../../../public/static/global/My97DatePicker/WdatePicker.js"></script>{extend name="$BASE_POPUP_FORM" /}
{block name="body"}
<link rel="stylesheet" type="text/css" href="__STATIC__/easyui/themes/custom/easyui.css" />
<style>
    .edui-editor, .edui-editor-iframeholder {
        width: 790px !important;
    }
    .img_upload_wrp .img_upload_box.img_upload_preview_box{
        width:120px !important;
        height:120px !important;
    }
    .tab-panel .html-content {
        height: 511px!important;
    }
</style>
    <div class="tab-content">
        <div id="js_div0" class="html-content" >
            <input type="hidden" id="id" name="id" value="{$id}"/>
            <input type="hidden" id="news_json" name="news_json" />
            <div class="control-row col-2">
                <div class="control-group">
                    <label class="control-label">标题</label>
                    <div class="controls">
                        <input type="text" style="width:300px" id="title" name="title" placeholder="输入标题" class="form-control required" />
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label">描述</label>
                    <div class="controls">
                        <input type="text" style="width:300px" id="intro" name="intro" placeholder="输入描述" class="form-control required" />
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label">是否显示</label>
                    <div class="controls">
                        <select name="is_show" id="is_show" class="form-control">
                            <option value="1">是</option>
                            <option value="0">否</option>
                        </select>
                    </div>
                </div>

            </div>
            <div class="control-group" >
                <label class="control-label">选择图片</label>
                <div class="controls">
                    <div class="controls">
                        <div id="js_upload_wrp">
                            <input type="hidden" id="images" name="images" value="" class="" />
                            {:hook('picResource',array('name'=>'images','limit_num'=> '5','checktype'=>2,'folder'=>'news','tips'=>'建议尺寸：800x600像素。仅支持.jpg .png格式长方形照片，大小不超过1M。','callback'=>'uploadImgCallback'))}
                        </div>
                    </div>
                </div>
            </div>
            <div class="control-group video_url_div" style="">
                <label class="control-label">
                    视频
                </label>
                <div class="controls">
                    <div id="">
                        <input type="hidden" id="video_path" name="video_path" value="" class="" />
                        {:hook('videoResource',array('name'=>'video_path','folder'=>'video_cover','tips'=>'建议上传正确的视频。','callback'=>'uploadVideoCallback'))}
                    </div>
                </div>
            </div>
            <div class="control-group">
                <label class="control-label">内容</label>
                <div class="controls">
                    <textarea id="content" name="content"></textarea>
                    {:hook('editor', array('height'=>'','id'=>"$id",'name'=>'content'))}
                </div>
            </div>

        </div>
    </div>

{/block}
{block name="script"}
<script type="text/javascript" src="__STATIC__/layer/laydate/laydate.js"></script>
<script type="text/javascript">


    function uploadVideoCallback(path) {
        $("#video_path").val(path);
        setVideoValue('video_path',path)
        $("#video_url").val(path);
    }

    function changeTab(tag){
        console.log(tag)
        if(tag==1){
            $(".addclass").hide();
        }else{
            $(".addclass").hide();
            $(".addclass").eq((tag-2)).show();
        }

    }
    $("#js_tab .tab-item").click(function () {
        var tag = $(this).data("tag");
        switchTab(tag);
    });
    /**
     * 切换选项卡样式
     */
    function switchTab(tag) {
        $("#js_tab .tab-item").removeClass("current");
        $("#js_tab .tab-item[data-tag='" + tag + "']").addClass("current");
        $(".html-content").hide();
        $("#js_div" + tag).show();
    }
    //发布时间插件
    laydate.render({
        elem: '#release_at'
        , type: 'datetime'
    });
    //上传回调
    function uploadImgCallback(data) {
        $("#images").val(data);
        setPicValue("images",data);
        // setVideoValue('video_path',data['video_path'])
    }

    //音频回调
    function uploadAudioCallback(path) {
        $("#audio_url").val(path);
    }

    /**
     * 点击图片删除
     * */
    $('#js_upload_wrp').on("click", ".js_delete", function (e) {
        var _this = $(this);
        _this.parents(".js_edit_pic_wrp").remove();
        setPicValue()
    });

    function onLoadDataSuccess(data)
    {

        if (typeof (onLoadSuccess) !== "undefined")
            onLoadSuccess();
        if (data.images) {
            var images = data.images;
            uploadImgCallback(images)
        }
    }
</script>
{/block}


